package com.swanclouds.redfish.managers.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.managers.Managers;
import com.swanclouds.redfish.common.redfish.Status;

import java.util.Map;

public class ManagerModel implements Managers {
    //管理资源可执行的操作
    @JsonProperty("Actions")
    private Map<String,Object> action;

    //指定管理资源的详细类型
    @JsonProperty("ManagerType")
    private String managerType;

    //电源状态
    @JsonProperty("PowerState")
    private String powerState;

    //指定管理资源的全局唯一标识符
    @JsonProperty("UUID")
    private String UUID;

    //BMC服务实例信息的访问路径
    @JsonProperty("@odata.id")
    private String dataId;

    //BMC服务信息的OData描述信息
    @JsonProperty("@odata.context")
    private String context;

    //BMC服务资源集合的类型
    @JsonProperty("@odata.type")
    private String type;

    //BMC服务实例信息的ID
    @JsonProperty("Id")
    private String id;

    //BMC服务实例信息的名称
    @JsonProperty("Name")
    private String name;

    //管理资源制造商
    @JsonProperty("Manufacturer")
    private String manufacturer;

    //指定管理资源的型号
    @JsonProperty("Model")
    private String model;

    //指定管理资源的FW版本号
    @JsonProperty("FirmwareVersion")
    private String firmwareVersion;

    //指定管理资源的系统时间
    @JsonProperty("DateTime")
    private String dateTime;

    //指定管理资源的时区
    @JsonProperty("DateTimeLocalOffset")
    private String dateTimeLocalOffset;

    /**
     * 指定管理资源的状态
     * 管理资源使能状态，包括：Enabled
     * 管理资源健康状态，包括：OK
     */
    @JsonProperty("Status")
    private Status status;

    //序列号
    @JsonProperty("SerialNumber")
    private String serialNumber;

    //图形控制台属性
    @JsonProperty("GraphicalConsole")
    private Map<String,Object> graphicalConsole;

   //串口控制台属性
    @JsonProperty("SerialConsole")
    private Map<String,Object> serialConsole;

    //自定义属性信息
    @JsonProperty("Oem")
    private Map<String,Object> oem;

    //资源相关链接
    @JsonProperty("Links")
    private Map<String,Object> links;

    @Override
    public String getManagerType() {
        return managerType;
    }

    @Override
    public String getPowerState() {
        return this.powerState;
    }

    public Map<String, Object> getAction() {
        return action;
    }

    public String getUUID() {
        return UUID;
    }

    @Override
    public String getDataId() {
        return this.dataId;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public String getContext() {
        return this.context;
    }

    @Override
    public String getType() {
        return this.type;
    }

    @Override
    public String getManufacturer() {
        return this.manufacturer;
    }

    @Override
    public String getModel() {
        return this.model;
    }

    @Override
    public String getSerialNumber() {
        return this.serialNumber;
    }

    public String getFirmwareVersion() {
        return firmwareVersion;
    }

    public String getDateTime() {
        return dateTime;
    }

    public String getDateTimeLocalOffset() {
        return dateTimeLocalOffset;
    }

    public Status getStatus() {
        return status;
    }

    public Map<String, Object> getGraphicalConsole() {
        return graphicalConsole;
    }

    public Map<String, Object> getSerialConsole() {
        return serialConsole;
    }

    public Map<String, Object> getOem() {
        return oem;
    }

    public Map<String, Object> getLinks() {
        return links;
    }

    public void setDateTime(String dateTime) {
        this.dateTime = dateTime;
    }

    public void setDateTimeLocalOffset(String dateTimeLocalOffset) {
        this.dateTimeLocalOffset = dateTimeLocalOffset;
    }

    public void setGraphicalConsole(Map<String, Object> graphicalConsole) {
        this.graphicalConsole = graphicalConsole;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "ManagerModel{" +
                "action=" + action +
                ", managerType='" + managerType + '\'' +
                ", powerState='" + powerState + '\'' +
                ", UUID='" + UUID + '\'' +
                ", dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", manufacturer='" + manufacturer + '\'' +
                ", model='" + model + '\'' +
                ", firmwareVersion='" + firmwareVersion + '\'' +
                ", dateTime='" + dateTime + '\'' +
                ", dateTimeLocalOffset='" + dateTimeLocalOffset + '\'' +
                ", status=" + status +
                ", serialNumber='" + serialNumber + '\'' +
                ", graphicalConsole=" + graphicalConsole +
                ", serialConsole=" + serialConsole +
                ", oem=" + oem +
                ", links=" + links +
                '}';
    }
}
